import fetch from 'common/src/utils/fetch';
/**
 * 查询学生强化班
 * @param {*} params 
 */
export function getStrengthenClassInfoList(params) {
  let query = '?'
  for (const key in params) {
    query += key
    query += '='
    query += params[key]
    query += '&'
  }
  return fetch({
    url: '/api/cultureservice/ScRegisterTimeInfo/getStrengthenClassInfo' + query,
    method: 'get'
  })
}

/*
*分页查询强化班录取学生信息
*/
export function getStrengthenStudentInfoList(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/getListScStudentToAdmit',
    method: 'post',
    data: template
  })
}

/*
*一键录取学生
*/
export function oneClickAdmitStudent(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/oneClickAdmitStudent',
    method: 'post',
    data: template
  })
}

/*
*录取预览
*/
export function admissionPreview(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/admissionPreview',
    method: 'post',
    data: template
  })
}

/**
 * 导出强化班学生名单
 * @param {Object} params
 */
export function exportExcelScStudentInfo(params) {
  const url = '/api/cultureservice/ScAdmStuRel/exportExcelScStudentInfo';
  let queryParam = ''
  for (const key in params) {
    // 去掉空参数
    if (
      key === 'pageNum_' ||
      key === 'pageSize_' ||
      key === 'total_' ||
      params[key] === ''
    ) {
      continue
    }
    queryParam += `${key}=${params[key]}&`
  }
  console.log(queryParam)
  window.open(`${url}?${queryParam}`)
}

/*
*w保存停招风险的学生备注信息
*/
export function saveNoteForMajorRisk(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/saveNoteForMajorRisk',
    method: 'post',
    data: template
  })
}

/*
*取消录取
*/
export function cancelAdmitStudent(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/cancelAdmission',
    method: 'post',
    data: template
  })
}
